//
//  Message.m
//  HotWord
//
//  Created by Rainbow on 7/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "Message.h"

@implementation Message
@synthesize senderUserId;
@synthesize recevierUserId;
@synthesize content;
@synthesize timestamp;
@synthesize dialogEmail;
@synthesize dialogNickname;
@synthesize dialogAvator;
@synthesize isReaded;
@synthesize isSentFailed;

- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:self.senderUserId forKey:@"senderUserId"];
	[aCoder encodeObject:self.recevierUserId forKey:@"recevierUserId"];
	[aCoder encodeObject:self.content forKey:@"content"];
	[aCoder encodeObject:self.timestamp forKey:@"timestamp"];
	[aCoder encodeObject:self.dialogEmail forKey:@"dialogEmail"];
	[aCoder encodeObject:self.dialogNickname forKey:@"dialogNickname"];
	[aCoder encodeObject:self.dialogAvator forKey:@"dialogAvator"];
	[aCoder encodeObject:self.isReaded forKey:@"isReaded"];
	[aCoder encodeObject:self.isSentFailed forKey:@"isSentFailed"];
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
	if ([self init]) {
		self.senderUserId= [aDecoder decodeObjectForKey:@"senderUserId"];
		self.recevierUserId = [aDecoder decodeObjectForKey:@"recevierUserId"];
		self.content = [aDecoder decodeObjectForKey:@"content"];
		self.timestamp = [aDecoder decodeObjectForKey:@"timestamp"];
		self.dialogEmail = [aDecoder decodeObjectForKey:@"dialogEmail"];
		self.dialogNickname = [aDecoder decodeObjectForKey:@"dialogNickname"];
		self.dialogAvator = [aDecoder decodeObjectForKey:@"dialogAvator"];
		self.isReaded = [aDecoder decodeObjectForKey:@"isReaded"];
		self.isSentFailed = [aDecoder decodeObjectForKey:@"isSentFailed"];
    }
	return self;
}

-(void)dealloc
{
    [senderUserId release];
    [recevierUserId release];
    [content release];
    [timestamp release];
    [dialogEmail release];
    [dialogNickname release];
    [dialogAvator release];
    [isReaded release];
    [isSentFailed release];
    [super dealloc];
}
@end
